﻿using System.Reflection;
using System.Resources;

using Job.Core.Common;

namespace Job.Core
{
    /// <summary>
    /// 本程序集资源封装。　
    /// </summary>
    internal sealed class RS
    {
        #region Properties

        private static readonly ResourceManager rm = new ResourceManager("Job.Core.Resource", Assembly.GetExecutingAssembly());
        
        #endregion

        #region Methods

        /// <summary>
        /// 从资源文件中获取一个对象。
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static object GetObject(string name)
        {
            return rm.GetObject(name);
        }

        /// <summary>
        /// 从资源文件中获取一个字符串。
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static string GetString(string name)
        {
            return rm.GetString(name);
        }

        /// <summary>
        /// 从资源文件中获取一个字符串并使用 args 数组替换相应的项。
        /// </summary>
        /// <param name="name"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static string GetString(string name, params object[] args)
        {
            return string.Format(GetString(name), args);
        }
        #endregion
    }
}